$(document).ready(function(){
	
	if(box){
			jQuery.facebox({ ajax: box });	
	}
	


var teste = 0;


$(document).ready(function(){
	
	
	//%%%%%%%%%%%%%%%% MODALBOX %%%%%%%%%%%%%%%%%		
	 $('a[rel*=facebox]').facebox({
		loadingImage : 'imagens/icones_sistema/loading.gif',
		closeImage   : 'imagens/icones_sistema/closelabel.png'
	 });
	 //%%%%%%%%%%%%%%% FIM MODALBOX %%%%%%%%%%%%%%
	 
	//%%%%%%%%%%%%% AUTO-SUGESTÃO %%%%%%%%%%%%%%	
	
	/*var options_xml = {
		script:"sugestoes.php?",
		varname:"input"
	};
	var as_xml = new AutoSuggest('busca', options_xml);*/	
	 
	var options1 = {
		script:"sugestoes.php?json=true&",
		varname:"input",
		json:true
		//callback: function (obj) {}
	};
	var as_json = new AutoSuggest('busca', options1);
	//%%%%%%%%%%%%% FIM AUTO-SUGESTÃO %%%%%%%%%%%%%%
	
	
	//%%%%%%%%%%%%% BANNER %%%%%%%%%%%%%%
	$('.banner-nivo').show();
	
	$('#nivo-slider').nivoSlider({
		itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { carousel.remove(i); }},
		effect:'fade', // Specify sets like: 'fold,fade,sliceDown,random'
       // slices:20, // For slice animations
       // boxCols: 8, // For box animations
       // boxRows: 4, // For box animations
        animSpeed:800, // Slide transition speed
        pauseTime:8000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:false, // 1,2,3... navigation
       // controlNavThumbs:false, // Use thumbnails for Control Nav
       // controlNavThumbsFromRel:false, // Use image rel for thumbs
      //  controlNavThumbsSearch: '.jpg', // Replace this with...
       // controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
       // keyboardNav:false, // Use left & right arrows
        pauseOnHover:true, // Stop animation while hovering
       // manualAdvance:false, // Force manual transitions
        captionOpacity:0.8, // Universal caption opacity
        prevText: 'Anterior', // Prev directionNav text
        nextText: 'Próximo', // Next directionNav text
       /* beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded*/
	
	});
	//%%%%%%%%%%%%% FIM BANNER %%%%%%%%%%%%%%
	
	//%%%%%%%%% CARROSSEL %%%%%%%%%%%
	$("#carrossel").carouFredSel({
		auto	: {
			items 			: 1,
			duration		: 2000,
			easing			: "linear",
			pauseDuration	: 0,
			pauseOnHover	: true
		},
		height:80
	}).trigger("play");
	
	$("#carrossel-dir").click(function() {
		$("#carrossel").trigger("pause");
		$("#carrossel").trigger("configuration", ["direction", "right"]);
		$("#carrossel").trigger("play");
		return true;
	});
	
	$("#carrossel-esq").click(function() {
		$("#carrossel").trigger("pause");
		$("#carrossel").trigger("configuration", ["direction", "left"]);
		$("#carrossel").trigger("play");
		return true;
	});
	$("#carrossel-dir").hover(function(){
		$("#carrossel").trigger("pause");
	},function(){
		$("#carrossel").trigger("play");
	});
	$("#carrossel-esq").hover(function(){
		$("#carrossel").trigger("pause");
	},function(){
		$("#carrossel").trigger("play");
	});
	//%%%%%%%%% FIM CARROSSEL %%%%%%%%%%%
	
	
		
	//%%%%%%%%%%%%%% TOOLTIPS %%%%%%%%%%%%%%%
	if(tooltips_title.length > 0){
		for(i=0;i<tooltips_title.length;i++){ 
			 $('#'+(i+1)).qtip({
				position: { 
				   my: 'bottom center', /* Use the corner... */
				   at: 'top center' /*...and opposite corner*/
				},
				style: {
					classes: 'ui-tooltip-shadow ui-tooltip-youtube tooltip top-class'
				},
				content: {
				   text: tooltips[i], 
				   title: {
					  text: tooltips_title[i],
					  button: false
				   }
				},hide: {
				   fixed: true
				}
				
				  
				
			});
		}
	}
	//%%%%%%%%%%%%%% FIM TOOLTIPS %%%%%%%%%%%%%%%
	

		
	});


});





/*

function buscar(){
	alert('merda');
		var termo = document.getElementById('busca').value;
		alert(termo);
		//var filtro = document.getElementById("filtro").value;
		//var query_filtro="";
		
		//if(filtro > 0){ query_filtro= "&filtro="+filtro;}
		if(termo.length > 0 && termo != '<?=$valor_busca_default?>'){
			
			window.location.href = "<?=DIR_ROOT?>index.php?busca="+termo;//+query_filtro;	
		}
		
		return false;
			
}
function valor_input(obj,padrao){
	alert(obj.value);
	var valor = obj.value;
	if(valor == ""){
		obj.value = padrao;
	}else if(valor == padrao){
		obj.value = "";
	}	
}

$("#busca").watermark('<?=$valor_busca_default?>');
	

*/